import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;


public class Producer{
	public static void main(String[] args) throws Exception {
            ConnectionFactory cf = new ConnectionFactory();
            cf.setHost("192.168.1.105");
            cf.setUsername("liwenbin");
            cf.setPassword("123456");
            Connection connection = cf.newConnection();
            Channel channel = connection.createChannel();
            String message = "Hello World!";
            String QUEUE_NAME = "hello";
            channel.basicPublish("", QUEUE_NAME, null, message.getBytes());
            System.out.println("publish ok");
            channel.close();
            connection.close();
	}
}

